      program smooq

c$$$ STH: This program convolves the output spectrum from pisco to Spitzer resolution. Compile smooq.f by "ifort smooq.f -o smooq" on r900-1 (replace ifort with g77 on lon). spec.q must be in the directory where smooq is run.

        parameter (mw = 8192)
        parameter (mrot = 8)
        dimension vw(mw),fw(mw,mrot),gw(mw)

        open(unit=9,file='spec.q',access='sequential')
        open(unit=10,file='smoo.q',access='sequential')

        nw = 8192
        nsm = 500
        xnsm = 2*nsm+1
        do jrot = 1,2
          do iw = 1,nw
            read(9,'(i4,f8.2,8f8.3)') kw,vw(iw),(fw(iw,irot),irot=1,8)
          enddo
          do irot = 1,8
            do iw = 1,nw
              jw1 = iw-2*nsm
              jw2 = iw
              gsum = 0.
              do jw = jw1,jw2
                kw = max(1,min(nw,jw))
                gsum = gsum+fw(kw,irot)
              enddo
              gw(iw) = gsum/xnsm
            enddo
            do iw = 1,nw
              jw1 = iw-nsm
              jw2 = iw+nsm
              gsum = 0.
              do jw = jw1,jw2
                kw = max(1,min(nw,jw))
                gsum = gsum+gw(kw)
              enddo
              fw(iw,irot) = gsum/xnsm
            enddo
          enddo
          do iw = 1,nw
            ww = vw(iw)+0.5*nsm
            write(10,'(i4,f9.2,8f8.3)') iw,ww,(fw(iw,irot),irot=1,8)
          enddo
        enddo

        close(unit=9)
        close(unit=10)

      end
